# def fun():
#     # 定义局部变量(只在函数体内部生效)
#     a = 100
#     print(a)
# fun()
# # 定义全局变量
# n = 200
# print(n)
#
# def fun1():
#     # 声明n是全局变量
#     global n
#     n = 300
#     print(n)
#
# def fun2():
#     print(n + 1)
#
# fun1()
# fun2()
#
# def fun3():
#     return 50
#
# def fun4(n):
#     print(n)
#
# fun4(fun3())
#
#
# # return 返回多个值
# def fun5():
#     return 100,200,300
#
#
# print(fun5())
# ==========================================================
# # 参数的传递
# # 定义阶段
# # 缺省参数/默认参数(默认参数必须放到最后边)
# def user_info(name, age, sex, Country="中国", minzu="汉族"):  # 形参
#     print(f"您的名字是{name}, 年龄是{age},性别是{sex},国籍:{Country},民族{minzu}")
#
#
# # 调用阶段
# # 位置参数传递(参数的位置和个数必须保持和定义阶段一致)
# user_info("悟空", 5000, "雄性")
# user_info(5000, "雄性", "悟空")
# # 关键字参数传递(关键字参数传递之间没有顺序)
# user_info("八戒", sex="男", age=6000)
#
# user_info("如来", 10000, "男", "天竺")
# user_info("如来", 10000, "男", minzu="满族")

# ------------------------------------------------------
# # 不定长参数传递
# # 不定长包裹位置参数传递
# def user_info1(*args):
#     print(args)
#
#
# user_info1()
# user_info1("哪吒", 5000, "男", "陈塘关")
# # 提前准备好的数据
# msg = ["玲珑宝塔", 5050, "男", "陈塘关"]
# user_info1(*msg)
# ---------------------------
# # 不定长包裹关键字参数传递
# def user_info2(**kwargs):
#     print(kwargs)


# user_info2(name="金吒", age=5020, sex="男")
# # 提前准备好了数据
# msg = {'name': '木吒', 'age': 5010, 'sex': '男'}
# user_info2(**msg)
# # 综合运用
# def user_info3(name,age,*args,**kwargs):
#     print(name)
#     print(age)
#     print(args)
#     print(kwargs)
#
# user_info3("黑熊精",6000,"男","印度",hobby="偷袈裟",hobby2="看门")


# 解包
# def fun():
#     return 100, 200
#
#
# res1, res2 = fun()
# print(res1)
# print(res2)
# list1 = [300, 400]
# res3, res4 = list1
# print(res3)
# print(res4)
# msg2 = {'name': '八戒', 'age': 7000}
# a,b = msg2.items()
# print(a)
# print(b)

def test1(a):
    print(a)
    print(id(a))
    a += a
    print(a)
    print(id(a))

# test1(1)

test1([1,2,3])

"""
可变数据类型: 列表,字典, 集合
不可变: 字符串, 元组, 布尔, 整型,浮点型, None
"""